package com.example.rxjava.demo1.activity;

import android.app.Activity;
import android.os.Bundle;

import com.example.rxjava.demo1.HttpManager;
import com.example.rxjava.demo1.HttpOnNextListener;
import com.example.rxjava.demo1.ProgressSubscriber;
import com.example.rxjava.demo1.SubjectPost;

import java.util.List;

import rx.subjects.Subject;

/**
 * Created by Administrator on 2016/12/24.
 */
public class QueryActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }


    private void simpleDo() {
        SubjectPost postEntity = new SubjectPost(new ProgressSubscriber(simpleOnNextListener, this), true);
        HttpManager manager = HttpManager.getInstance();
        manager.doHttpDeal(postEntity);
    }

    //   回调一一对应
    HttpOnNextListener simpleOnNextListener = new HttpOnNextListener<List<Subject>>() {
        @Override
        public void onNext(List<Subject> subjects) {
            tvMsg.setText("已封装：\n" + subjects.toString());
        }
    };
}
